<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
 <%@ include file="/common/query.jsp"%>
<%@ include file="/common/det.jsp"%>
<script>
        $(function(){
            init();
        });
        function init(){
            var setting = {};
            var url ="";
            var p_insert = false;
            var p_del = false;
			var categoryAttrGroupViewer = (getQueryStringByDecode("categoryAttrGroupViewer")=="true" );
            var productViewer = (getQueryStringByDecode("productViewer")=="true" );
            if(productViewer){
                categoryAttrGroupViewer = true;
			}
            if(categoryAttrGroupViewer!=null){
                var add = !categoryAttrGroupViewer;
                var edit= !categoryAttrGroupViewer;
                var del = !categoryAttrGroupViewer;
			}


            var columns = [
                {field:'pid',title:'pid',rowHidden:true},
                {field:'name',title:'类目',require:true,search:{type:"single"}},
                {field:'id',title:'id',hidden:categoryAttrGroupViewer,update:false,insert:false,width:10},
                {field:'enName',title:'英文类目名称',require:true,hidden:categoryAttrGroupViewer},
                {field:'code',title:'编码',require:true,hidden:categoryAttrGroupViewer},
                {field:'icon',title:'图标',type:"img",hidden:categoryAttrGroupViewer},
                {field:'picUrl',title:'图片',type:"img",hidden:categoryAttrGroupViewer},
                {field:'orderBy',title:'排序',type:"number",defaultValue:0,hidden:categoryAttrGroupViewer},
                {field:'enable',title:'是否启用',hidden:categoryAttrGroupViewer,
                    input:{type:'radio',value : [{text:'未启用',value:0,isDefault:true},{text:'已启用',value : 1}]}
                },
                {field:'remark',title:'备注',hidden:categoryAttrGroupViewer}

            ];
            var tree = {
                pid:'pid',
                id : 'id',
                tpid:'0',
                treeField:'name',
                sort:'xuhao'
            };
            url='/product/category/manager?';
            if(categoryAttrGroupViewer){
                url += "search_EQ_enable=1&"
			}
            //setting.singleSelec	t = true;
            createQuery('body',columns,{searchBar:{hidden:categoryAttrGroupViewer},
                onClickRow:function () {
                    var html='';
                    if(categoryAttrGroupViewer){
                        if(!productViewer){
                            seeProductCategoryAttrgroup();
                        }else{
                            window.parent.seeProduct(getGridSelected());
                        }

                    }
                    return html;
                },
				editBtn:!categoryAttrGroupViewer,
				pager:false,edit:edit,add:add,del:del,tree:tree,heji:false,singleSelect:true},url);
        };
        function seeProductCategoryAttrgroup() {
                var row = getGridSelected();
                window.parent.seeProductCategoryAttrgroup(row);
        }
</script>
</head>
<body>
	  <div id="body"></div>
</body>
</html>